package com.ace.model.bo;

/***********************************************************************
 * Module:  Assure.java
 * Author:  a.kanwar
 * Purpose: Defines the Class Assure
 ***********************************************************************/

import java.util.*;


public class Assure {
   
    
   /**********************************************************************
    * Attribute
    **********************************************************************/ 
   public int idAssure;
   public java.lang.String nom, prenom;
   public java.util.Date dateDeNaissance;
   public java.lang.String adresse;
   public int codePostal;
   public java.lang.String ville, profession, numPermis;
   public java.util.Date dateDePermis;
   
   public java.util.Collection<Vehicule> vehicule;
   public java.util.Collection<Contrat> contrat;
   public HistoriqueAssure historiqueAssure;
   public Paiement paiement;
   public Agence agence;

   
   /************************************************
    * Constructor
    ************************************************/
   
    public Assure(int idAssure, String nom, String prenom, Date dateDeNaissance, String adresse, int codePostal, String ville, String profession, String numPermis, Date dateDePermis, Collection<Vehicule> vehicule, Collection<Contrat> contrat, HistoriqueAssure historiqueAssure, Paiement paiement, Agence agence) {
        this.idAssure = idAssure;
        this.nom = nom;
        this.prenom = prenom;
        this.dateDeNaissance = dateDeNaissance;
        this.adresse = adresse;
        this.codePostal = codePostal;
        this.ville = ville;
        this.profession = profession;
        this.numPermis = numPermis;
        this.dateDePermis = dateDePermis;
        this.vehicule = vehicule;
        this.contrat = contrat;
        this.historiqueAssure = historiqueAssure;
        this.paiement = paiement;
        this.agence = agence;
    }

    public Assure(String nom, String prenom, Date dateDeNaissance, String adresse, int codePostal, String ville, String profession, String numPermis, Date dateDePermis, Collection<Vehicule> vehicule, Collection<Contrat> contrat, HistoriqueAssure historiqueAssure, Paiement paiement, Agence agence) {
        this.nom = nom;
        this.prenom = prenom;
        this.dateDeNaissance = dateDeNaissance;
        this.adresse = adresse;
        this.codePostal = codePostal;
        this.ville = ville;
        this.profession = profession;
        this.numPermis = numPermis;
        this.dateDePermis = dateDePermis;
        this.vehicule = vehicule;
        this.contrat = contrat;
        this.historiqueAssure = historiqueAssure;
        this.paiement = paiement;
        this.agence = agence;
    }
    
    /**************************************************
     * getter and setter
     *  
     **************************************************/

    public int getIdAssure() {
        return idAssure;
    }

    public void setIdAssure(int idAssure) {
        this.idAssure = idAssure;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getPrenom() {
        return prenom;
    }

    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }

    public Date getDateDeNaissance() {
        return dateDeNaissance;
    }

    public void setDateDeNaissance(Date dateDeNaissance) {
        this.dateDeNaissance = dateDeNaissance;
    }

    public String getAdresse() {
        return adresse;
    }

    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }

    public int getCodePostal() {
        return codePostal;
    }

    public void setCodePostal(int codePostal) {
        this.codePostal = codePostal;
    }

    public String getVille() {
        return ville;
    }

    public void setVille(String ville) {
        this.ville = ville;
    }

    public String getProfession() {
        return profession;
    }

    public void setProfession(String profession) {
        this.profession = profession;
    }

    public String getNumPermis() {
        return numPermis;
    }

    public void setNumPermis(String numPermis) {
        this.numPermis = numPermis;
    }

    public Date getDateDePermis() {
        return dateDePermis;
    }

    public void setDateDePermis(Date dateDePermis) {
        this.dateDePermis = dateDePermis;
    }

    public HistoriqueAssure getHistoriqueAssure() {
        return historiqueAssure;
    }

    public void setHistoriqueAssure(HistoriqueAssure historiqueAssure) {
        this.historiqueAssure = historiqueAssure;
    }

    @Override
    public String toString() {
        return "Assure{" + "idAssure=" + idAssure + ", nom=" + nom + ", prenom=" + prenom + ", dateDeNaissance=" + dateDeNaissance + ", adresse=" + adresse + ", codePostal=" + codePostal + ", ville=" + ville + ", profession=" + profession + ", numPermis=" + numPermis + ", dateDePermis=" + dateDePermis + ", vehicule=" + vehicule + ", contrat=" + contrat + ", historiqueAssure=" + historiqueAssure + ", paiement=" + paiement + ", agence=" + agence + '}';
    }
   
    
    
    
    
    
    
    
    
    
    
   
   
   
   
   /**********************************************
    * generate code by power AMC
    * 
    **********************************************/
   public java.util.Collection<Vehicule> getVehicule() {
      if (vehicule == null)
         vehicule = new java.util.HashSet<Vehicule>();
      return vehicule;
   }
   
   /** @pdGenerated default iterator getter */
   public java.util.Iterator getIteratorVehicule() {
      if (vehicule == null)
         vehicule = new java.util.HashSet<Vehicule>();
      return vehicule.iterator();
   }
   
   /** @pdGenerated default setter
     * @param newVehicule */
   public void setVehicule(java.util.Collection<Vehicule> newVehicule) {
      removeAllVehicule();
      for (java.util.Iterator iter = newVehicule.iterator(); iter.hasNext();)
         addVehicule((Vehicule)iter.next());
   }
   
   /** @pdGenerated default add
     * @param newVehicule */
   public void addVehicule(Vehicule newVehicule) {
      if (newVehicule == null)
         return;
      if (this.vehicule == null)
         this.vehicule = new java.util.HashSet<Vehicule>();
      if (!this.vehicule.contains(newVehicule))
      {
         this.vehicule.add(newVehicule);
         newVehicule.setAssure(this);      
      }
   }
   
   /** @pdGenerated default remove
     * @param oldVehicule */
   public void removeVehicule(Vehicule oldVehicule) {
      if (oldVehicule == null)
         return;
      if (this.vehicule != null)
         if (this.vehicule.contains(oldVehicule))
         {
            this.vehicule.remove(oldVehicule);
            oldVehicule.setAssure((Assure)null);
         }
   }
   
   /** @pdGenerated default removeAll */
   public void removeAllVehicule() {
      if (vehicule != null)
      {
         Vehicule oldVehicule;
         for (java.util.Iterator iter = getIteratorVehicule(); iter.hasNext();)
         {
            oldVehicule = (Vehicule)iter.next();
            iter.remove();
            oldVehicule.setAssure((Assure)null);
         }
      }
   }
   /** @pdGenerated default getter */
   public java.util.Collection<Contrat> getContrat() {
      if (contrat == null)
         contrat = new java.util.HashSet<Contrat>();
      return contrat;
   }
   
   /** @pdGenerated default iterator getter */
   public java.util.Iterator getIteratorContrat() {
      if (contrat == null)
         contrat = new java.util.HashSet<Contrat>();
      return contrat.iterator();
   }
   
   /** @pdGenerated default setter
     * @param newContrat */
   public void setContrat(java.util.Collection<Contrat> newContrat) {
      removeAllContrat();
      for (java.util.Iterator iter = newContrat.iterator(); iter.hasNext();)
         addContrat((Contrat)iter.next());
   }
   
   /** @pdGenerated default add
     * @param newContrat */
   public void addContrat(Contrat newContrat) {
      if (newContrat == null)
         return;
      if (this.contrat == null)
         this.contrat = new java.util.HashSet<Contrat>();
      if (!this.contrat.contains(newContrat))
      {
         this.contrat.add(newContrat);
         newContrat.setAssure(this);      
      }
   }
   
   /** @pdGenerated default remove
     * @param oldContrat */
   public void removeContrat(Contrat oldContrat) {
      if (oldContrat == null)
         return;
      if (this.contrat != null)
         if (this.contrat.contains(oldContrat))
         {
            this.contrat.remove(oldContrat);
            oldContrat.setAssure((Assure)null);
         }
   }
   
   /** @pdGenerated default removeAll */
   public void removeAllContrat() {
      if (contrat != null)
      {
         Contrat oldContrat;
         for (java.util.Iterator iter = getIteratorContrat(); iter.hasNext();)
         {
            oldContrat = (Contrat)iter.next();
            iter.remove();
            oldContrat.setAssure((Assure)null);
         }
      }
   }
   /** @pdGenerated default parent getter */
   public Paiement getPaiement() {
      return paiement;
   }
   
   /** @pdGenerated default parent setter
     * @param newPaiement */
   public void setPaiement(Paiement newPaiement) {
      if (this.paiement == null || !this.paiement.equals(newPaiement))
      {
         if (this.paiement != null)
         {
            Paiement oldPaiement = this.paiement;
            this.paiement = null;
            oldPaiement.removeAssure(this);
         }
         if (newPaiement != null)
         {
            this.paiement = newPaiement;
            this.paiement.addAssure(this);
         }
      }
   }
   /** @pdGenerated default parent getter */
   public Agence getAgence() {
      return agence;
   }
   
   /** @pdGenerated default parent setter
     * @param newAgence */
   public void setAgence(Agence newAgence) {
      if (this.agence == null || !this.agence.equals(newAgence))
      {
         if (this.agence != null)
         {
            Agence oldAgence = this.agence;
            this.agence = null;
            oldAgence.removeAssure(this);
         }
         if (newAgence != null)
         {
            this.agence = newAgence;
            this.agence.addAssure(this);
         }
      }
   }

}